1. Field of the Invention
The present invention relates generally to an image inpainting apparatus and method, and more particularly to an image inpainting apparatus and method in which a search region used in image inpainting is restricted so as to be inpainted with an image most similar to an image region to inpaint.
2. Description of the Related Art
Image inpainting is a technology that originated from restoring damaged works of art in a museum, and is currently used for various purposes, such as restoring a damaged part of a picture or photograph, or removing a part from a picture or photograph.
Such image inpainting technology interpolates pixels of a background image region around a boundary part of a target image to be inpainted when there is the target image, and to fill the region of the target image with the interpolated pixels. Here, the background image represents a remaining image, except for the target image to be inpainted in the original image.
However, a resultant image generated using image inpainting technology has a problem in that a large blur is caused therein.
Various technologies have been studied to compensate the image inpainting technology, and one of them is a technology entitled “Object Removal by Exemplar-Based Inpainting.”
The exemplar-based inpainting searches a background image for an image most similar to a background image part adjacent to the boundary part of a target image by making reference to edges and flat regions within the original image, and to fill the region of the target image with the searched image.
Specifically, referring to FIGS. 1A to 1C, an image inpainting apparatus using the exemplar-based inpainting technology sets a target image, as shown in FIG. 1B, within an original image as shown in FIG. 1A. Then, the image inpainting apparatus sets an inpainting image region, which includes a background image region adjacent to the boundary part of the target image and a boundary image region of the target image. Here, the inpainting image region has a preset size, and includes a portion of the target image to be inpainted.
The image inpainting apparatus searches for a similar image region, which has pixel values most similar to those in the set inpainting image region, within the background image. In this case, the pixel values in the inpainting image region represent pixel values in the background image region within the inpainting image region. Also, here, the pixel values includes red, green and blue (RGB) average values, an RGB distribution, edge values, etc. of pixels included in the image region.
Thereafter, the image inpainting apparatus copies only a similar target image, which corresponds to the target image region within the inpainting image region, from the searched similar image region, and then pastes the copied similar target image into the target image region of the inpainting image region. The image inpainting apparatus repeatedly performs the aforementioned operation until image inpainting has been completed. When image inpainting has been completed, a resultant image as shown in FIG. 1C is displayed.
As described above, the conventional image inpainting apparatus inpaints a damaged image using the exemplar-based inpainting technology. However, there is a problem in that, when the image inpainting apparatus searches for a similar image region having pixel values most similar to those in an inpainting image region, an image completely different from an image to inpaint a target image region may be searched for.
Specifically, referring to FIGS. 2A to 2D, when removing a flowerpot image, as shown in FIG. 2B, from an exemplar image as shown in FIG. 2A, and inpainting an image of a corresponding position, an image inpainting apparatus searches for the most similar portion within an inpainting image region, and performs image inpainting based on the searched portion. However, in this case, an image of a portion determined to be similar may be an image which is close in distance but is a completely different image, as shown in FIG. 2C, so that an error as shown in FIG. 2D may occur.